﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TemplateFileList.aspx.cs"
    Inherits="Manage_Cms_TemplateFileList" %>

<html>
<head>
<title>模板管理</title>
    <!--#include file="../js/html_head.inc"-->
    <link rel="stylesheet" type="text/css" href="../Themes/<%=ManageHelper.GetTheme()%>/style.css" />
</head>
<body>
    <%=ManageHelper.PageSucMsg()!=""?"<div class='msg_succeed'>"+ManageHelper.PageSucMsg()+"</div>":""%>
    <%=ManageHelper.PageErrMsg()!=""?"<div class='msg_failed'>"+ManageHelper.PageErrMsg()+"</div>":""%>
    <div class="mycolumn" style="border: 0; margin: 0; padding: 0">
        <table align="left">
            <tr>
                <%
                    foreach (KeRui.Model.SysConfig model in listType)
                    {
                        if (1 == 1)
                        {
                %>
                <td align="left" class="tdbutton">
                    <input type="button" value="添加<%=model.Name%>" class="button" style="width: 100px;"
                        onclick="ymPrompt.win('TemplateFileItem.aspx?siteid=<%=SiteID %>&TemplateID=<%=TemplateID %>&FileType=<%=model.Value %>&ID=',600,430,'添加<%=model.Name%>',null,null,null,true);" />
                </td>
                <%
                    }
                    }
                %>
            </tr>
        </table>
    </div>
    <div class="mycolumn">
        <div class="columntitle">
            模板检索</div>
        <form action="?SiteID=<%=SiteID %>" method="post">
        <input name="TemplateID" type="hidden" value="<%=TemplateID %>" />
        <table width="100%" border="0" align="center" cellpadding="2" cellspacing="2">
            <tbody>
                <tr class="summary-title" align="left">
                    <td align="left" style="padding-left: 10px; line-height: 26px;" class="tdsearch">
                        模板类型：<select name="FileType" id="FileType">
                            <%=KeRui.BLL.Common.GetSelectList(FileType, ds, "—所有类型—")%>
                        </select>
                        &nbsp;&nbsp;文件名称：<input name="FileName" type="text" value="<%=FileName %>" />
                        <input type="submit" value="搜 索" class="button" style="margin-bottom: 0px; width: 60px;" />
                    </td>
                </tr>
            </tbody>
        </table>
        </form>
    </div>
    <div class="column">
        <div class="columntitle">
            模板管理（当前模板名称：<span style="color: Maroon"><%=modelTemplate.TemplateName %></span>，模板文件夹：<span
                style="color: Maroon"><%=modelTemplate.TemplateFolder %></span>）</div>
        <table cellspacing="0" cellpadding="0" rules="all" align="center" border="0" id="MyDataGrid"
            style="border-width: 0px; width: 100%; border-collapse: collapse;">
            <tr class="summary-title" style="height: 25px" align="left">
                <td style="width: 18%;">
                    &nbsp;&nbsp;文件名称
                </td>
                <td style="width: 10%;">
                    模板类型
                </td>
                <td style="width: 15%;" align="center">
                    网页自动生成时间
                </td>
                <td style="width: 10%;" align="center">
                    频率（分钟）
                </td>
                <td style="width: 10%;" align="center">
                    使用次数
                </td>
                <td style="width: 15%;" align="center">
                    模板修改时间
                </td>
                <td align="center">
                    操作
                </td>
            </tr>
            <%
               
                string strFileName = "";
                foreach (KeRui.Model.CmsTemplateFile model in list)
                {
                    if (strFileName != model.FileName.Substring(0, (model.FileName + "_").IndexOf('_')))
                    {
            %>
            <tr class="tdbg">
                <td align="left" colspan="8">
                    <span class="columntitle" style="width: 100%"><b>
                        <%=model.FileName.Substring(0, (model.FileName + "_").IndexOf('_'))%>
                    </b></span>
                </td>
            </tr>
            <% 
                }
                    strFileName = model.FileName.Substring(0, (model.FileName + "_").IndexOf('_'));
            %>
            <tr class="tdbg" onmouseover="this.className='tdbg-dark';" onmouseout="this.className='tdbg';"
                style="height: 25px;" align="left">
                <td>
                    &nbsp;&nbsp;<%=model.FileName%>
                </td>
                <td>
                    <%=WebConfig.GetName("TemplateFileType", model.FileType.ToString())%>
                </td>
                <td align="center">
                    <%=model.FileUpdateTime %>
                </td>
                <td align="center">
                    <%=model.FileUpdateInterval>1?model.FileUpdateInterval+"分钟":"不自动更新"%>
                </td>
                <td align="center">
                    <%=model.UsingNum%>
                </td>
                <td align="center">
                    <%=model.UpdateTime%>
                </td>
                <td align="center">
                    <a href="javascript:ymPrompt.win('TemplateFileListBackUp.aspx?SiteID=<%=SiteID %>&ID=<%=model.FileID %>',600,430,'历史还原',null,null,null,true);">
                        历史</a> | <a href="TemplateFileItem.aspx?act=reduce&TemplateID=<%=model.TemplateID %>&id=<%=model.FileID %>"
                            onclick="javascript:return confirm('此操作将还原模板“<%=model.FileName %>”，确认吗？');">
                            <%=model.IsDefault == 0 ? "还原 |" : ""%>
                        </a><a href="javascript:ymPrompt.win('TemplateFileItem.aspx?SiteID=<%=SiteID %>&act=edit&TemplateID=<%=model.TemplateID %>&FileType=<%=model.FileType %>&ID=<%=model.FileID %>',600,430,'修改模板',null,null,null,true);">
                            编辑</a> |
                    <%=model.IsDefault != 0 ? "<a href=\"TemplateFileItem.aspx?siteId=" + SiteID + "&act=del&id=" + model.FileID + "&TemplateID=" + model.TemplateID + "\" onclick=\"javascript:return confirm('此操作将删除模板“" + model.FileName + "”，确认吗？');\">删除</a>" : "<s>删除</s>"%>
                    | <a href="TemplateFileItem.aspx?ID=<%=model.FileID %>&act=view" target="_blank">预览</a>
                    <% 
                        if (model.FileType == 7)
                        {
                    %>
                    | <a href="javascript:ymPrompt.win('SubjectTemplateItem.aspx?siteid=<%=SiteID %>&id=<%=model.FileID %>&TemplateID=<%=model.TemplateID %>',500,230,'更改图样和预览',null,null,null,true);">
                        匹配</a>
                    <% 
                        }
                    %>
                </td>
            </tr>
            <%
                }
            %>
        </table>
    </div>
</body>
</html>
